<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.hertz.appr.pojo.Admin"%>
<%@page import="com.hertz.appr.oauth.OAuth"%>
<%@page import="com.hertz.appr.oauth.RequestToken"%>
<%@page import="com.hertz.appr.util.Configuration"%>
<%@page import="com.hertz.appr.oauth.OAuthToken"%>
<%@page import="com.hertz.appr.oauth.AccessToken"%>
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@page import="org.springframework.context.ApplicationContext"%>
<%@page import="com.hertz.appr.service.RobotGang"%>
<%@page import="com.hertz.appr.pojo.db.Robot"%>
<%@page import="com.hertz.appr.pojo.User"%>
<%@page import="com.hertz.appr.oauth.OAuthToken"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'add_robot_ok.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
    <%
    	String provider = "qq";
    	String verifier = request.getParameter("oauth_verifier");
    	RequestToken resToken = (RequestToken)session.getAttribute("resToken");
    	OAuth oauth = new OAuth(provider);
    	oauth.setOauthToken(resToken);
    	AccessToken acsToken = oauth.getOAuthAccessToken(verifier);
    	User user = User.getUser(new OAuth("qq",acsToken));
     %>
     <form action="gang/add_robot_ok.jsp" method="post">
     	uid:<%=user.getUid() %><br>
     	nick:<%=user.getNick() %><br>
     	token:<%=acsToken.getToken() %><br>
     	token secret:<%=acsToken.getTokenSecret() %><br>
     	<input type="hidden" name="uid" value="<%=user.getUid() %>">
     	<input type="hidden" name="nick" value="<%=user.getNick() %>">
     	<input type="hidden" name="token" value="<%=acsToken.getToken() %>">
     	<input type="hidden" name="tokenSecret" value="<%=acsToken.getTokenSecret() %>">
     	<input type="hidden" name="provider" value="sina">
     	type:<select name="type">
     		<option value="0">只读</option>
     		<option value="1">只写</option>
     		<option value="2">读写</option>
     	</select><br>
     	<input type="submit" >
     </form>
  </body>
</html>
